package com.ruoyi.project.stats.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author LoKa
 * @date 2020-09-17 23:21
 */
public interface StatsMapper {
    @Select("select distinct status from stats_task_mission")
    String[] selectDistinctTaskStatus();

    @Select("select distinct urgencyLevel from stats_task_mission")
    String[] selectDistinctTaskUrgency();

    @Select("select count(*) from stats_task_mission where status=#{status} and urgencyLevel=#{urgencyLevel}")
    int getCountByStatusAndUrgency(@Param("status") String status,@Param("urgencyLevel") String urgency);

    @Select("select distinct project_phase from stats_project_completion")
    String[] selectDistinctProjectPhase();

    @Select("select count(*) from stats_project_completion where project_phase=#{phase}")
    int getCountByPhase(String phase);

    @Select("select distinct order_type from stats_sale_order")
    String[] selectDistinctOrderType();

    @Select("select distinct customer_info from stats_sale_order")
    String[] selectDistinctCustomerInfo();

    @Select("select count(*) from stats_sale_order where order_type=#{type} and customer_info=#{customer} ")
    Integer getCountByTypeAndCustomer(@Param("type") String orderType,@Param("customer") String customer);

    @Select("select sum(project_amount) from stats_sale_order where customer_info=#{customer}")
    Integer getAmountCountByCustomer(String customer);

    @Select("select sum(order_payment) from stats_sale_order_payment where customer_info=#{customer}")
    Integer getUnpaidAmount(String customer);
}
